/**
 * There are <a href="https://github.com/thinkgem/jeesite">JeeSite</a> code generation
 */
package com.chlitina.store.modules.cash.entity;

import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;

import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
import org.hibernate.annotations.NotFound;
import org.hibernate.annotations.NotFoundAction;

import com.chlitina.store.common.persistence.BaseEntity;
import com.chlitina.store.modules.base.entity.StoreProduct;
import com.chlitina.store.modules.employee.entity.Employee;

/**
 * 购买产品Entity
 * @author Songsong.XU
 * @version 2013-11-07
 */
@Entity
@Table(name = "store_consume_buy_product")
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
public class StoreConsumeBuyProduct extends BaseEntity {
	public static final int PAY_TYPE_CARD_PRODUCT = 0;
	public static final int PAY_TYPE_CARD_ALL = 1;
	public static final int PAY_TYPE_CASH = 2;
	public static final int PAY_TYPE_GIFT = 3;
	private static final long serialVersionUID = 1L;
	private Long id; 		// 编号
	private StoreConsume storeConsume;//消费单
    private StoreProduct storeProduct;
    private Employee employee;
	private float retail_price;//零售单价
	private float real_cost;//实际成交价
	private int amount;//购买数量
	private float real_cost_total;//成交总价
	private int payment_type;//付款方式
	private long card_id;//产品充值卡或综合充值卡编号
	private float bonus;//会员提成
	private String remark;//备注信息
	
	 
	public float getRetail_price() {
		return retail_price;
	}

	public void setRetail_price(float retail_price) {
		this.retail_price = retail_price;
	}

	public float getReal_cost() {
		return real_cost;
	}

	public void setReal_cost(float real_cost) {
		this.real_cost = real_cost;
	}

	public int getAmount() {
		return amount;
	}

	public void setAmount(int amount) {
		this.amount = amount;
	}

	public float getReal_cost_total() {
		return real_cost_total;
	}

	public void setReal_cost_total(float real_cost_total) {
		this.real_cost_total = real_cost_total;
	}

	public int getPayment_type() {
		return payment_type;
	}

	public void setPayment_type(int payment_type) {
		this.payment_type = payment_type;
	}

	public long getCard_id() {
		return card_id;
	}

	public void setCard_id(long card_id) {
		this.card_id = card_id;
	}

	public float getBonus() {
		return bonus;
	}

	public void setBonus(float bonus) {
		this.bonus = bonus;
	}

	public String getRemark() {
		return remark;
	}

	public void setRemark(String remark) {
		this.remark = remark;
	}

	public StoreConsumeBuyProduct() {
	}

	public StoreConsumeBuyProduct(Long id){
		this();
		this.id = id;
	}
	
	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}
	
	@ManyToOne(cascade={CascadeType.REFRESH}, fetch = FetchType.LAZY) 
	@JoinColumn(name="CONSUME_ID")
	@NotFound(action = NotFoundAction.IGNORE)
	@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
	@NotNull
	public StoreConsume getStoreConsume() {
		return storeConsume;
	}

	public void setStoreConsume(StoreConsume storeConsume) {
		this.storeConsume = storeConsume;
	}

	@ManyToOne(cascade={CascadeType.REFRESH}, fetch = FetchType.LAZY) 
	@JoinColumn(name="PRODUCT_ID")
	@NotFound(action = NotFoundAction.IGNORE)
	@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
	@NotNull
	public StoreProduct getStoreProduct() {
		return storeProduct;
	}

	public void setStoreProduct(StoreProduct storeProduct) {
		this.storeProduct = storeProduct;
	}
	
	@ManyToOne(cascade={CascadeType.REFRESH}, fetch = FetchType.LAZY) 
	@JoinColumn(name="EMPLOYEE_ID")
	@NotFound(action = NotFoundAction.IGNORE)
	@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
	@NotNull
	public Employee getEmployee() {
		return employee;
	}

	public void setEmployee(Employee employee) {
		this.employee = employee;
	}



	 
}


